package com.sajus.web.billing.ejb.data.model;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "offering")
@NamedQueries({
	@NamedQuery(name = "Offering.findAll", query = "SELECT off FROM Offering off"),
	@NamedQuery(name = "Offering.findCurrentIndex", query ="SELECT r FROM Offering r WHERE r.id= ( SELECT max(d.id) FROM Offering d )" )
	})
public class Offering extends PersistentObject{
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "id")
	private Integer id;
	
	private String description;
	
	@ManyToOne(cascade = CascadeType.ALL)
	@JoinColumn(name="serviceType")
	private ServiceType serviceType;
	

	private double baseRate;
	
	private double limits;
	private double step1Unit;
	private double step1Rate;
	private double step2Unit;
	private double step2Rate;
	
	private double minUnit;
	private double minRate;
	private double maxUnit;
	private double maxRate;
	
	private String preRule;
	private String postRule;
	
	
	@Override
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}


	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public ServiceType getServiceType() {
		return serviceType;
	}

	public void setServiceType(ServiceType serviceType) {
		this.serviceType = serviceType;
	}

	public double getBaseRate() {
		return baseRate;
	}

	public void setBaseRate(double baseRate) {
		this.baseRate = baseRate;
	}

	public double getLimits() {
		return limits;
	}

	public void setLimits(double limit) {
		this.limits = limit;
	}

	public double getStep1Unit() {
		return step1Unit;
	}

	public void setStep1Unit(double step1Unit) {
		this.step1Unit = step1Unit;
	}

	public double getStep1Rate() {
		return step1Rate;
	}

	public void setStep1Rate(double step1Rate) {
		this.step1Rate = step1Rate;
	}

	public double getStep2Unit() {
		return step2Unit;
	}

	public void setStep2Unit(double step2Unit) {
		this.step2Unit = step2Unit;
	}

	public double getStep2Rate() {
		return step2Rate;
	}

	public void setStep2Rate(double step2Rate) {
		this.step2Rate = step2Rate;
	}

	public double getMinUnit() {
		return minUnit;
	}

	public void setMinUnit(double minUnit) {
		this.minUnit = minUnit;
	}

	public double getMinRate() {
		return minRate;
	}

	public void setMinRate(double minRate) {
		this.minRate = minRate;
	}

	public double getMaxUnit() {
		return maxUnit;
	}

	public void setMaxUnit(double maxUnit) {
		this.maxUnit = maxUnit;
	}

	public double getMaxRate() {
		return maxRate;
	}

	public void setMaxRate(double maxRate) {
		this.maxRate = maxRate;
	}

	public String getPreRule() {
		return preRule;
	}

	public void setPreRule(String preRule) {
		this.preRule = preRule;
	}

	public String getPostRule() {
		return postRule;
	}

	public void setPostRule(String postRule) {
		this.postRule = postRule;
	}

}
